package com.sinog.front.controller.biz;

import com.sinog.core.utilbean.Constants;
import com.sinog.front.feign.biz.XttzService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @desc 系统通知
 * @author lizhiqiang
 * @date -
 */
@RestController
public class XttzController {

    @Resource
    private XttzService xttzService;

    /**
     * 获取首页系统通知列表
     * @return Map<String,Object>
     */
    @GetMapping("/basic/tzgg/getXttzList")
    public Map<String,Object> getSyTzggList() {
        List<HashMap<String,Object>> resultList = xttzService.getXttzList();
        List<Map<String,Object>> returnList = new ArrayList<>(16);
        Map<String,Object> resmap = new HashMap<>(16);
        for(HashMap<String,Object> stringObjectHashMap : resultList) {
            Map<String,Object> resultMap = new HashMap<>(16);
            //编号
            String id = stringObjectHashMap.get("id").toString();
            //编号
            resultMap.put("id",id);
            //标题
            resultMap.put("title",stringObjectHashMap.get("title"));
            //发布单位
            resultMap.put("fbdw",stringObjectHashMap.get("fbdw"));
            //添加日期
            resultMap.put("adddate",stringObjectHashMap.get("adddate"));
            //是否标红
            resultMap.put("titlecolor",stringObjectHashMap.get("titlecolor"));
            //类型
            resultMap.put("type",stringObjectHashMap.get("type"));
            //是否被查看
            resultMap.put("new","1");
            resultMap.put("content",stringObjectHashMap.get("content"));
            returnList.add(resultMap);
        }
        resmap.put("error", Constants.Number.NUM_ZERO);
        resmap.put("data",returnList);
        resmap.put("msg","success");
        return resmap;
    }
}